<template>
  <text v-if="show" class="second-txt" :class="{'goods-detail':page=='goodsDetail'}" >
    <text class="se-l se-item">
      官方验
    </text>
    <text class="se-r se-item">
      <text v-if="new_old===1">全新</text>
      <text v-if="new_old===2">
        {{levelList[level].name}}
      </text>
    </text>
  </text>
</template>

<script>

export default {
  // otherCss为true,不显示css,由外部控制
  props:['new_old','level','page','lease_type'],
  data() {
    return {
      levelList: {
        '99new': { name: '99新', id: '99new' },
        '95new': { name: '95新', id: '95new' },
        '90new': { name: '9成新', id: '90new' },
        '80new': { name: '8成新', id: '80new' },
        '70new': { name: '7成新', id: '70new' }
      }
    }
  },
  computed:{
    show(){
      // 商城不显示
      if(this.lease_type==2){
        return false
      }
      if(this.new_old==1 || (this.new_old==2 && this.level)){
        return true
      }
    }
  }
}
</script>

<style lang="scss" scoped>
.second-txt{
  margin-right: 10rpx;
  border-radius: 8rpx;
  //white-space: nowrap;
  font-size: 20rpx;
  //display: inline-flex;
  //align-items: center;
  .se-item{
    padding: 0 8rpx;
    line-height: 20rpx;
    border: 1rpx solid var(--view-theme);
  }
  .se-l{
    background: var(--view-theme);
    color: #fff;
    border-bottom-left-radius: 8rpx;
    border-top-left-radius: 8rpx;
  }
  .se-r{
    color: var(--view-theme);
    border-bottom-right-radius: 8rpx;
    border-top-right-radius: 8rpx;
  }
}
.goods-detail{
  font-size: 26rpx;
  .se-item{
    padding: 8rpx 12rpx;
  }
}
</style>